﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Com.Charence.PassManager.BusinessEntities;

namespace Com.Charence.PassManager.DataComponents
{
    public class CommonDC
    {
        public User GetUserBasicInfo(int userId)
        {
            using (var context = new Entities())
            {
                return context.Users.First(p => p.IsActive && p.UserID == userId);
            }
        }

        public List<string> GetAccOwnerSource(string query)
        {
            using (var context = new Entities())
            {
                var result = from s in context.AccountBases
                             where s.WebSiteName.Contains(query)
                             select s.WebSiteName;
                return result.Distinct().ToList();
            }
        }
    }
}
